﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SetPaperQuestions.aspx.cs" Inherits="OA.Exam.SetPaperQuestions" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>设置试卷大题</title>
    <link href="../Themes/Default/Style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" language="javascript">
        //验证文本框输入
        function CheckInput() {
            var mark=0;
            var allTxt = document.getElementsByTagName("input");
            var myReg = /^[0-9]*[1-9][0-9]*$/;
            for (var i = 0; i < allTxt.length; i++) {

                if (allTxt[i].id.indexOf("DataListBig") != -1) {
                    if (allTxt[i].value.length == 0||!myReg.test(allTxt[i].value)) {
                        mark++;
                    }
                }
            }
            if (mark == 0) {
                return true;
            }
            else {
                document.getElementById("<%=LabPrompt.ClientID %>").innerHTML = "输入有误，必须为正整数！";
                return false;
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
          <table width="98%">
            <tr>
                <td colspan="2" class="TitleZone">
                    <asp:Label ID="LblTitle" runat="server" Text="维护大题"></asp:Label>
                    <input id="HiddenPaperId" type="hidden" runat="server" />
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <asp:Label ID="LabPrompt" runat="server" Text="" ForeColor="Red"></asp:Label>
                </td>
            </tr>
            <tr>
                <td style="width:80%">
                    
                </td>
                <td style="width:20%">
                    <asp:LinkButton ID="LbtnBack" runat="server" onclick="LbtnBack_Click">返回</asp:LinkButton>&nbsp;
                    <asp:LinkButton ID="LbtnSave" runat="server" CssClass="closebtn" 
                        onclick="LbtnSave_Click" OnClientClick="return CheckInput()">保存</asp:LinkButton>&nbsp;
                    <asp:HyperLink ID="HylPreview" runat="server">预览试卷并设置主观题分值</asp:HyperLink>
                </td>
            </tr>
            <tr>
                <td style="width:80%">
                    
                </td>
                <td style="width:20%">
                    <asp:DropDownList ID="DdlType" runat="server" CssClass="" DataTextField="TypeName" DataValueField="TypeId">
                        
                    </asp:DropDownList>
                    <asp:LinkButton ID="LbtnAddType" runat="server" CssClass="closebtn" 
                        ValidationGroup="add" onclick="LbtnAddType_Click">添加题型</asp:LinkButton>
                    <asp:RequiredFieldValidator ID="RfvType" runat="server" ErrorMessage="请选择题型" 
                        InitialValue="-1" Display="Dynamic" ValidationGroup="add" 
                        ControlToValidate="DdlType"></asp:RequiredFieldValidator>
                    
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:DataList ID="DataListBig" runat="server" Width="98%" 
                        DataKeyField="ItemType" onitemcommand="DataListBig_ItemCommand" 
                        onitemdatabound="DataListBig_ItemDataBound">
                        <ItemTemplate>
                            <table width="98%">
                                <tr>
                                    <td style="width:30%">
                                        <%#Container.ItemIndex+1 %>、<%#Eval("TypeName") %>
                                    </td>
                                    <td style="width:30%">
                                        每题分值：
                                        <asp:TextBox ID="TxtScore" runat="server" Text='<%#Eval("Score") %>' CssClass="inputText"></asp:TextBox>
                                    </td>
                                    <td style="width:25%">
                                        大题排序号：
                                        <asp:TextBox ID="TxtDispOrder" runat="server" Text='<%#Eval("DispOrder") %>' CssClass="inputText"></asp:TextBox>
                                    </td>
                                    <td style="width:15%">
                                        <asp:LinkButton ID="LbtnDelete" runat="server" CommandName="DeleteType">移除大题</asp:LinkButton>|
                                        <asp:LinkButton ID="LbtnAdd" runat="server" CommandName="AddQueston">添加小题</asp:LinkButton>
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                    </asp:DataList>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <span style="color:Red">备注：主观题不批量设置分值。</span>
                </td>
            </tr>
        </table>

    </div>
    </form>
</body>
</html>
